//
//  CALayer+ZXSublayer.m
//  ZXAnimationUtil
//
//  Created by 朱新明 on 2023/7/17.
//

#import "CALayer+ZXSublayer.h"

@implementation CALayer (ZXSublayer)



+ (CAGradientLayer *)gradientLayerWithFrame:(CGRect)frame
                                     colors:(NSArray *)colors
                                  locations:(nullable NSArray <NSNumber *> *)locations
                                 startPoint:(CGPoint)startPoint
                                   endPoint:(CGPoint)endPoint
{
    CAGradientLayer *gradient = [CAGradientLayer layer];
    gradient.frame = frame;
    gradient.colors = colors;
    gradient.locations = locations ? locations:@[@0,@1];
    gradient.startPoint = startPoint;
    gradient.endPoint = endPoint;
    return gradient;
}


+ (CAReplicatorLayer *)replicatorLayerWithSublayer:(CALayer *)sublayer
{
    CAReplicatorLayer *replicatorLayer = [CAReplicatorLayer layer];
    [replicatorLayer addSublayer:sublayer];
    return replicatorLayer;
}


@end
